package src.lab02.test01.Test13;

public class Gymnastics extends  ComputerAverage{
    @Override
    //Gymnastics类中计算选手的平均成绩的方法是去掉一个最低分，去掉一个最高分，然后求平均分。
    public double average(double[] scores) {
        for (int i = 0;i <5 ; i++){
            for (int j = i + 1; j <5 ; j++){
                if (scores[i]>scores[j]){
                    double n = scores[i];
                    scores[i] = scores[j];
                    scores[j] =  n;
                }
            }
        }
        double []average = {scores[2],scores[3],scores[4]};
        double average1 = (average[0] +average[1]+ average[2])/3;
        System.out.println("除去最高法和最低分之后："+scores[1]+" "+scores[2]+" "+scores[3]);
        return average1;
    }
}

